<template>
  <van-nav-bar title="分类" />
  <van-row>
    <van-col span="6">
      <van-sidebar v-model="active">
        <van-sidebar-item v-for="item in fenData" :title="item.cat_name" />
      </van-sidebar>
    </van-col>
    <van-col span="18">
      <div v-for="items in fenData[active]?.children">
        <h4>{{ items.cat_name }}</h4>
        <router-link :to="'/goods/'+items.cat_id">
          <van-grid :column-num="4">
            <van-grid-item
              v-for="itemx in items.children"
              :key="value"
              :icon="itemx.cat_icon"
              :text="itemx.cat_name"
            />
          </van-grid>
        </router-link>
      </div>
    </van-col>
  </van-row>
</template>

<script setup>
import { ref } from "vue";
const active = ref(0);
import { fenApi } from "@/api/api";
let fenData = ref([]);
fenApi().then((res) => {
  console.log("分类数据", res);
  fenData.value = res.data.message;
});
</script>

<style lang="scss" scoped></style>
